﻿using MediatR;
using RBAC.Common.Domains;
using RBAC.Common.Dto;
using RBAC.Common.infrastructures.interfaces;
using RBAC.Enum;

namespace RBAC.api.Application.commond.RBAC
{
    public class PermissionCreateHander : IRequestHandler<PermissionCreateCommond, Rulst>
    {

        private readonly IbaseRpository<Permission> _permisson;

        public PermissionCreateHander(IbaseRpository<Permission> permisson)
        {
            _permisson = permisson;
        }

        public async Task<Rulst> Handle(PermissionCreateCommond request, CancellationToken cancellationToken)
        {
           
            var result=new Rulst() { Code=(int)Reult .success};


            var list=_permisson.Query().ToList();   

            if(list!=null)
            {
                result.data = list;
                result.MSG = "查询成功";
            }
            return result;


        }
    }
}
